include:
  - dev.stop_app
{% set SERVER = pillar['server'] %}
{% set APP_LOCATION =  pillar['app_location'] %}
{% set COMMIT = pillar['commit'] %}
{% set APP_NAME = pillar.get('app_name') %}
deploy_conf:
  file.recurse:
    - name: {{APP_LOCATION}}/{{SERVER}}/conf
    - source: salt://backup/{{APP_NAME}}/{{COMMIT}}/conf
    - include_empty: True
    - replace: True
    - group: mingjue
    - user: mingjue
    - clean: True
    - require:
      - cmd: stop_service

deploy_lib:
  file.recurse:
    - name: {{APP_LOCATION}}/{{SERVER}}/lib
    - source: salt://backup/{{APP_NAME}}/{{COMMIT}}/lib
    - include_empty: True
    - replace: True
    - group: mingjue
    - user: mingjue
    - clean: True
    - require:
      - cmd: stop_service

deploy_dependency:
  file.recurse:
    - name: {{APP_LOCATION}}/{{SERVER}}/lib
    - source: salt://backup/{{APP_NAME}}/{{COMMIT}}/dependency
    - include_empty: True
    - replace: True
    - group: mingjue
    - user: mingjue
    - clean: True
    - require:
      - cmd: stop_service